package com.zangchat.controller;

import com.common.core.controller.BaseController;
import com.common.core.domain.AjaxResult;
import com.zangchat.domain.mongoBean.MTrendsBean;
import com.zangchat.service.IMongoDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.zangchat.service.IChatTrendsService;

/**
 * 广场动态Controller
 * 
 * @author ruoyi
 * @date 2020-07-22
 */
@RestController
@RequestMapping("/zangchat/chatTrends")
public class ChatTrendsController extends BaseController
{
    @Autowired
    private IChatTrendsService chatTrendsService;


    /**
     * 用户发布动态
     * @param userId
     * @param trendLimit
     * @param trendsContenttai
     * @param gallery
     * @param trendsType
     * @param relayId
     * @param type
     * @return
     */
    @RequestMapping("releaseTrends")
    public AjaxResult releaseTrends(@ModelAttribute("userId") Long userId,
                                    @ModelAttribute("trendLimit") Integer trendLimit,
                                    @ModelAttribute("trendsContenttai") String trendsContenttai,
                                    @ModelAttribute("gallery") String gallery,
                                    @ModelAttribute("trendsType") Integer trendsType,
                                    @ModelAttribute("relayId") Long relayId,
                                    @ModelAttribute("type") Integer type){
        return chatTrendsService.releaseTrends(userId,trendLimit,trendsContenttai,gallery,trendsType,relayId,type);
    }

    /**
     * 用户评论
     * @param userId 用户id
     * @param content 评论内容
     * @param targetId  动态id
     * @return
     */
    @RequestMapping("userComment")
    public AjaxResult userComment(@ModelAttribute("userId") Long userId,
                                  @ModelAttribute("content") String content,
                                  @ModelAttribute("targetId") String targetId){
        return chatTrendsService.userComment(userId,content,targetId);
    }

    /**
     * 查看动态圈列表
     * @param userId
     * @param pageSize
     * @param pageNum
     * @return
     */
    @RequestMapping("/trendsList")
    public AjaxResult trendsList(@ModelAttribute("userId") Long userId,
                                 @ModelAttribute("pageSize") Integer pageSize,
                                 @ModelAttribute("pageNum") Integer pageNum,
                                 @ModelAttribute("type") String type){
        return chatTrendsService.trendsList(userId,pageSize,pageNum,type);
    }

    /**
     * 获取评论列表
     * @param userId
     * @return
     */
    public AjaxResult trendsCommentList(@ModelAttribute("userId") Long userId,
                                        @ModelAttribute("targetId") String targetId){
        return chatTrendsService.trendsCommentList(userId,targetId);
    }

}
